//
//  HttpClient.m
//  DotNetForApi
//
//  Created by weihong xuan on 2018/1/30.
//  Copyright © 2018年 weihong xuan. All rights reserved.
//

#import "HttpClient.h"

@implementation HttpClient

/**
 * 获得模块首页的信息
 */
+(void)get_indexNew_action:(NSString *)action withid:(NSString*)ID withName:(NSString*)name success:(void(^)(id responseObject))successBlock fail:(void(^)(NSString * error))failBlock{
    NSMutableDictionary *bodyDic = [NSMutableDictionary dictionaryWithCapacity:0];
    if (ID!=nil) {
        [bodyDic setObject:ID forKey:@"id"];
    }
    else{
        [bodyDic setObject:@"" forKey:@"id"];
    }
    [bodyDic setObject:name forKey:@"name"];
    
    [AFNetWorkingWrapper sendRequestWithParam:bodyDic method:@"get" action:action Success:^(NSURLSessionDataTask *operation, id responseObject) {
        
        successBlock(responseObject);
        
    } Fail:^(NSString *error) {

        failBlock(error);
        
    }];
}

/**
 * 获得OrderList
 */
+(void)get_OrderList_action:(NSString *)action withuid:(NSString*)uid success:(void(^)(id responseObject))successBlock fail:(void(^)(NSString * error))failBlock{
    NSMutableDictionary *bodyDic = [NSMutableDictionary dictionaryWithCapacity:0];
    if (uid !=nil) {
        [bodyDic setObject:uid forKey:@"uid"];
    }
    else{
        [bodyDic setObject:@"" forKey:@"uid"];
    }
    [AFNetWorkingWrapper sendRequestWithParam:bodyDic method:@"get" action:action Success:^(NSURLSessionDataTask *operation, id responseObject) {
        
        successBlock(responseObject);
        
    } Fail:^(NSString *error) {
        
        failBlock(error);
        
    }];
}

/**
 * 获得Login
 */
+(void)post_Login_action:(NSString *)action withuid:(NSString*)uid withname:(NSString*)name success:(void(^)(id responseObject))successBlock fail:(void(^)(NSString * error))failBlock{
    NSMutableDictionary *bodyDic = [NSMutableDictionary dictionaryWithCapacity:0];
    if (uid !=nil) {
        [bodyDic setObject:uid forKey:@"uid"];
    }
    else{
        [bodyDic setObject:@"" forKey:@"uid"];
    }
    [bodyDic setObject:name forKey:@"name"];
    [AFNetWorkingWrapper sendRequestWithParam:bodyDic method:@"post" action:action Success:^(NSURLSessionDataTask *operation, id responseObject) {
        
        successBlock(responseObject);
        
    } Fail:^(NSString *error) {
        
        failBlock(error);
        
    }];
}


@end
